<%@page contentType="text/html;charset=UTF-8"%>
<%@ page import="whf.framework.web.Constants"%>
<%@ page import="java.util.List"%>
<%@page import="whf.framework.util.ParamUtils"%>

<%@taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean"%>
<%@taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html"%>
<%@taglib uri="/WEB-INF/tlds/framework.tld" prefix="framework"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title><framework:attr source="STRUTS-META" attr="name" /></title>
<jsp:include page="/common/inc/select.jsp" />
<%
String queryString = "";
String submodule = ParamUtils.getParameter(request, "submodule");
if(submodule == null || "all".equals(submodule)){
	queryString = "order by t.code";
} else if("empty".equals(submodule)){
	queryString = "t.referencedObject is null order by t.code";
} else {
	queryString = "t.referencedObject.subModule = '" + submodule +"' order by t.code";
}
List submodules = (List)request.getAttribute("submodules");
%>
<script>
function submodule_change(){
	submitForm('list');
}
</script>
</head>

<body>
<html:form action='<%=  (String)request.getAttribute(Constants.STRUTS_PATH) %>' method="post">
<html:hidden property="webMethod" value="" />
<div align='right'>
	<framework:attr attr="framework.meta.object.submodule" />
	<select name="_$_submodule" onchange="submodule_change();">
		<option value = "all"> --- All --- </option>
		<option value = "empty" <% if("empty".equals(submodule)){ %>selected<% } %>> --- Indivdual --- </option>
		<%
		for(int i=0; i<submodules.size(); i++){
			String text = (String)submodules.get(i);
			String selected = "";
			if(whf.framework.util.StringUtils.equalsIgnoreCase(submodule, text)) selected = " selected ";
			request.setAttribute("text", text);
			request.setAttribute("selected", selected);
		%>
		<option value='<framework:attr source="text" />' <framework:attr source="selected" />><framework:attr source="text" /></option>
		<%}%>
	</select>
</div>
<framework:table pkStyle="checkbox_counter" navPosition="both" queryString="<%= queryString %>" view="SYSTEM-VIEW-VIEW">
<framework:caption><span class="whf_object_title"><framework:attr source="STRUTS-META" attr="name" /></span></framework:caption>
<framework:rowext><div nowrap><a href="View.do?webMethod=preview&id=${id}" target="_blank"><framework:attr source='i18n' attr='form.preview' /></a>
<a href="View.do?webMethod=export&id=${id}" target="_blank">XML</a>
<div></framework:rowext>
</framework:table>
<br>
<framework:funcbtn operation="prepareCreate" validationFunction="" valueKey="form.create" />
<framework:funcbtn operation="prepareUpdate" validationFunction="selectionMoreThanOne" valueKey="form.update" />
<framework:funcbtn operation="duplicate" 	validationFunction="selectionMoreThanOne" valueKey="form.duplicate" />
<framework:funcbtn operation="delete" 		validationFunction="selectionMoreThanOne" valueKey="form.delete" />
<html:reset><bean:message key="form.reset" /></html:reset>
</html:form>

<br><br><br>
</body>
</html> 